<template>
  <div style="width: 20%;" class="center">
    <el-form  label-width="100px">
      <el-form-item label="用户名" prop="username">
        <el-input type="text" v-model="user.username" placeholder="请输入用户" clearable></el-input>
      </el-form-item>
      <el-form-item label="密码" prop="password">
        <el-input type="password" v-model="user.password" placeholder="请输入密码" show-password ></el-input>
      </el-form-item>
      <el-button type="warning" @click="userlogin">登录</el-button>
     <template>
       <router-link to="/regist"><el-button type="danger">注册 </el-button></router-link>
     </template>
    </el-form>
  </div>
</template>

<script>
export default {
  name: "user",
  data(){
    return{
        user:{}
    }
  },
  methods:{
    userlogin(username,password){
      alert(this.user.username)
      this.axios.get("/user/login?username="+this.user.username+"&password="+this.user.password).then((resp)=>{
        this.$router.push("/buju")
        this.user={}
        this.user=resp.data
        this.$message.success("登录成功")
      })
    }
  }
}
</script>

<style scoped>

</style>
